@echo off
echo 开始构建前端项目...

REM 清理旧的构建文件
echo 清理旧的构建文件...
if exist "frontend-admin\dist" (
    rd /s /q "frontend-admin\dist"
)
if exist "frontend-h5\dist" (
    rd /s /q "frontend-h5\dist"
)

REM 构建管理后台
echo 构建管理后台...
cd frontend-admin
call npm run build
if %ERRORLEVEL% neq 0 (
    echo 管理后台构建失败
    pause
    exit /b 1
)
cd ..

REM 构建H5前端
echo 构建H5前端...
cd frontend-h5
call npm run build
if %ERRORLEVEL% neq 0 (
    echo H5前端构建失败
    pause
    exit /b 1
)
cd ..

echo 前端构建完成！
echo 管理后台构建结果在: frontend-admin\dist
echo H5前端构建结果在: frontend-h5\dist

pause
